package com.youku
{
   import flash.external.ExternalInterface;
   
   public class YoukuExternalInterface extends Object
   {
      
      public function YoukuExternalInterface() {
         super();
      }
      
      public static function get available() : Boolean {
         return ExternalInterface.available;
      }
      
      public static function addCallback(param1:String, param2:Function) : void {
         if(PlayerConfig.isTudouPlayer)
         {
            return;
         }
         ExternalInterface.addCallback(param1,param2);
      }
      
      public static function call(param1:String, ... rest) : * {
         if(PlayerConfig.isTudouPlayer)
         {
            return null;
         }
         switch(rest.length)
         {
            case 0:
               return ExternalInterface.call(param1);
            case 1:
               return ExternalInterface.call(param1,rest[0]);
            case 2:
               return ExternalInterface.call(param1,rest[0],rest[1]);
            case 3:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2]);
            case 4:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2],rest[3]);
            case 5:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2],rest[3],rest[4]);
            case 6:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2],rest[3],rest[4],rest[5]);
            case 7:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2],rest[3],rest[4],rest[5],rest[6]);
            case 8:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2],rest[3],rest[4],rest[5],rest[6],rest[7]);
            case 9:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2],rest[3],rest[4],rest[5],rest[6],rest[7],rest[8]);
            case 10:
               return ExternalInterface.call(param1,rest[0],rest[1],rest[2],rest[3],rest[4],rest[5],rest[6],rest[7],rest[8],rest[9]);
            default:
               throw new Error("too many argments");
         }
      }
   }
}
